888726e83e51e2d04f0055ec17fb123515c3f795,src/org/graphstream/stream/netstream/NetStreamReceiver.java,NetStreamReceiver,readFloatArray,#InputStream#,1489
Before Change
}
protected Float[] readFloatArray(InputStream in) {
byte[] data = new byte[4];
try {
if (in.read(data, 0, 4) != 4) {
debug("readFloatArray: could not read length of array (int)");
return null;
}
ByteBuffer bb = ByteBuffer.allocate(4);
bb.put(data);
bb.flip();
int len = bb.getInt();
data = new byte[len * 4];
if (in.read(data, 0, len * 4) != len * 4) {
debug("readFloatArray: could not read array");
return null;
}
bb = ByteBuffer.allocate(4 * len);
bb.put(data);
bb.flip();
Float[] res = new Float[len];
After Change
byte[] data = null;
try {
int len = (int) readUnsignedVarint(in);
data = new byte[len * 4];
if (in.read(data, 0, len * 4) != len * 4) {
debug("readFloatArray: could not read array");
return null;
}
ByteBuffer bb = ByteBuffer.allocate(4 * len);
bb.put(data);
bb.flip();
Float[] res = new Float[len];